#define _CRT_SECURE_NO_WARNINGS 1
#include "game.h"




void menu()
{
	printf("************************\n");
	printf("*****    1.play     ****\n");
	printf("*****    0.exit     ****\n");
	printf("************************\n");
}

void game()
{
	char mine[ROWS][COLS]; //存放雷的位置‘0’非雷，‘1’雷
	char show[ROWS][COLS]; //存放给游戏者看的棋盘‘*’

	

	//初始化棋盘
	//1.mine数组最开始里面全是'0'
	//2.show数组最开始里面全是'*'
	InitBoard(mine, ROWS, COLS, '0');
	InitBoard(show, ROWS, COLS, '*');

	//打印棋盘
	//DisplayBoard(mine, ROW, COL);

	//布置雷
	SetMine(mine, ROW, COL);//除了初始化，剩下传参只需要传ROW和COL即可
	
	DisplayBoard(show, ROW, COL);

	//查找雷
	FindMine(mine, show, ROW, COL);
}


int main()
{
	int input = 0;
	srand((unsigned int)time(NULL));

	do
	{
		menu();
		printf("请选择:>\n");
		scanf("%d", &input);

		switch (input)
		{
		case  1:
			game();
			break;
		case 0:
			printf("退出游戏\n");
			break;
		default:
			printf("输入错误，请重新选择\n");
			break;
		}
	} while (input);
	return 0;
}